GridPanelCtl = Ext.extend(CmpControler, {

	getCmItems : function() {

		var items = [{
					name : 'hello1',
					attId : 'file'
				}, {
					name : 'hello2',
					attId : 'file'
				}, {
					name : 'hello3',
					attId : 'file'
				}]

		return items;
	},
	bulidComponent : function() {

		var config = this.getCommonConfig();

		this.configRecordTemplet();

		config = this.configStore(config);

		config = this.configCm(config);

		config = this.configBbar(config);

		config = this.configOtherPara(config);

		var item = new Ext.grid.EditorGridPanel(config);

		return item;
	},
	afterBulidComponent : function() {
		this.cmp.on('rowdblclick', this.rowdblclick, this);
		this.cmp.on('rowcontextmenu', this.rowcontextmenu, this);
	},
	rowdblclick : function() {

	},
	getCommonConfig : function() {

		var config = {
			name : "dvd节目单"
		};

		return config;

	},
	configStore : function(config) {

		var url = this.getStoreUrl();

		var recordTemplet = this.recordTemplet;

		var reader = new Ext.data.JsonReader({
			// totalProperty : "totalSize",
			root : "items" // The property which contains an Array
				// of row objects
			}, recordTemplet);

		var store = new Ext.data.Store({
					url : url,
					reader : reader
				});

		this.store = store;
		config.store = store;

		return config;
	},
	getStoreUrl : function() {

	},
	configCm : function(config) {

		// var fm = Ext.form;
		var xg = Ext.grid;

		var items = this.getCmItems();
		var opt = [];
		for (var i = 0; i < items.length; i++) {

			// var dt = items[i].dataType;

			var item = items[i];
			var isCm = item.isCm;

			if (isCm) {
				var cmItem = {
					header : items[i].name,
					sortable : false,
					dataIndex : items[i].attId
				}
				opt.push(cmItem);
			}

		}

		var cm = new xg.ColumnModel(opt);

		config.autoExpandColumn = opt.length - 1;

		config.cm = cm;
		return config;
	},
	configOtherPara : function(config) {

		var sm = new Ext.grid.RowSelectionModel();

		//config.frame = true;
		config.sm = sm;
		// config.clicksToEdit = 2;
		//		config.listeners = {
		//			'render' : function() {
		//				sm.selectFirstRow();
		//			}
		//		};

		return config;
	},
	configRecordTemplet : function(attributeGroup) {

		var items = this.getCmItems();

		var config = [];
		for (var i = 0; i < items.length; i++) {

			var attribute = items[i];
			var cmItem = {
				name : attribute.attId
			}
			config.push(cmItem);
		}

		var recordTemplet = Ext.data.Record.create(config);
		this.recordTemplet = recordTemplet;

	},
	configBbar : function(config) {

		return config;
	},
	read : function(config) {

	},
	reload : function() {

		var store = this.store;
		store.reload();

	},
	getRootUrl : function() {

		var strFullPath = window.document.location.href;
		var strPath = window.document.location.pathname;
		var pos = strFullPath.indexOf(strPath);
		var prePath = strFullPath.substring(0, pos);
		var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);

		return (prePath + postPath + '/');

	}

});
